﻿namespace K9Nano.Captcha.Sms;

public interface ISmsCaptchaManager
{
    /// <summary>
    /// 验证验证码
    /// </summary>
    /// <param name="phone">手机号</param>
    /// <param name="code">验证码</param>
    /// <returns></returns>
    bool Validate(string phone, string code);

    /// <summary>
    /// 发送验证码
    /// </summary>
    /// <param name="phone">手机号</param>
    /// <param name="templateId">短信模板ID</param>
    /// <param name="expire">有效期</param>
    /// <param name="length">验证码长度</param>
    /// <returns>是否发生成功</returns>
    ValueTask<bool> SendAsync(string phone, string templateId, TimeSpan expire, int length = 4, CancellationToken cancellation = default);
}
